<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>DOM查找多个元素</title>
  </head>
  <body>
    <div class="box">testing 1</div>
    <div>testing 2</div>
    <div class="box">testing 3</div>
    <p>testing 4</p>

    <script>
      // 查找多个元素
      const myDivs = document.querySelectorAll("div");
      console.log(myDivs);
      console.log(myDivs[1]);
      const myDiv = document.querySelectorAll(".box");
      console.log(myDiv);
    </script>
  </body>
</html>
